<?php
  $lat=53.430606;
  $lng=14.556541;
  $zoom=12;
  $width=655;
  $height=600;
?>
<ul id="list" class="sort">
   <?php
   $i = 0;
   while ($r=mysql_fetch_array($database->result))
   {
      echo '<li id="item_'.$i++.'">'. $r['name'].'<br>'. $r['desc'].'&nbsp;&nbsp;&nbsp;<img src="images/delete.png" width="15" ></li> ';
   }
?>
    </ul>
    <input type="button" onclick="showSeq()" value="Kolejność">
 <!--   <input type="button" onclick="loadPointsEnd()" value="pobierz json"> -->
    <div id="result"></div>
    <div id="map" style="display:none; width: <?php echo $width; ?>px; height: <?php echo $height; ?>px"></div>
    <div id="directions"></div>
    <img onclick=""
<script type="text/javascript">
    Sortable.create("list",
{
	onUpdate: function()
	{
		refreshTrack();
	}
});
</script>
    <script type="text/javascript">
       //<![CDATA[
       var map;
       var bounds;

       initGMap();
       map.addControl(new GScaleControl() );
       map.setCenter(new GLatLng(53.380043, 14.648995), 13);
       
       var waypoints = [];
       var dirPanel = document.getElementById('directions');
       var directions = new GDirections(map, dirPanel);
       var polilinia;
       GEvent.addListener(directions,"error", function() {
          GLog.write('GDirections error nr: '+directions.getStatus().code);
          // map_moveend_listener = GEvent.addListener(map,'moveend',this.reloadMap);
          polilinia = null;
       });
       GEvent.addListener(directions,"addoverlay", function() {
          GLog.write('GDirections added overlay EVENT');
          if (polilinia)
             map.removeOverlay(polilinia);
          polilinia = directions.getPolyline();
          // map_moveend_listener = GEvent.addListener(map,'moveend',this.reloadMap);
          map.addOverlay(polilinia);
       });
       new Ajax.Request("model/getPointsFromList.php?id=<?php echo $idListy; ?>", {method: "get", onComplete: loadPointsEnd });

       //]]>
    </script>